home *** CD-ROM | disk | FTP | other *** search
- #include "oath/minString.h"
-
- #include <fstream.h>
-
- /////////////////////////////////////////////////////////////////////////////
- // Test of minStrings
-
- main()
- {// Create some Characters //////////
- characterA R = characterA::make('r');
- characterA S = characterA::make('s');
- characterA T = characterA::make('t');
- characterA L = characterA::make('l');
- characterA N = characterA::make('n');
- characterA E = characterA::make('e');
- characterA A = characterA::make('a');
-
- // Retrieve the Strings //////////
- ifstream File ("ms2.obj");
-
- stringA Star = stringA::isa(objA::import(File));
- stringA Sstare = stringA::isa(objA::import(File));
-
- cout << Star.am() << "\t(" << Star.hash() << ")" << endl;
- cout << Sstare.am() << "\t(" << Sstare.hash() << ")" << endl;
-
- // Test Strings //////////
- stringPosA Pstare = Sstare.makePos();
- cout << "First char is " << *Pstare << endl;
- Pstare.findMatch("tar");
- cout << "Char after tar is " << *Pstare << endl;
-
- Pstare.reset();
- if(Pstare.canMatch("sta"))
- cout << "It can match 'sta', if you wish." << endl;
-
- if(!!Pstare.match(""))
- cout << "It just matched nothing successfully." << endl;
-
- ///
-
- char * Buffer = new char [50];
- for(int I = 0; I < 5; I++)
- {for(int J = 0; J < 10; J++)
- Buffer[I*10 + J] = J;
- }
- stringA Sbuffer = minStringA::make(Buffer, Buffer+42);
- cout << "Sbuffer is " << Sbuffer.count() << " char's long." << endl;
- char * Buffer2 = new char [40];
- Sbuffer.charStarX(Buffer2, 40);
- if(!memcmp(Buffer, Buffer2, 40))
- cout << "Success! The buffers are the same!" << endl;
-
- }